package org.studiox.graph.persistence.mybatis.tk.base;

import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Column;
import javax.persistence.Id;
import java.sql.Timestamp;
import java.util.Objects;

public abstract class BaseGraphDO {

  @Id
  @Column(name = "id")
  @KeySql(useGeneratedKeys = true)
  private Long id;

  @Column(name = "type")
  private String type;

  @Column(name = "owner")
  private String owner;

  @Column(name = "deleted")
  private Boolean deleted;

  @Column(name = "create_time")
  private Timestamp createTime;

  @Column(name = "update_time")
  private Timestamp updateTime;

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

  public String getOwner() {
    return owner;
  }

  public void setOwner(String owner) {
    this.owner = owner;
  }

  public Boolean getDeleted() {
    return deleted;
  }

  public void setDeleted(Boolean deleted) {
    this.deleted = deleted;
  }

  public Timestamp getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Timestamp createTime) {
    this.createTime = createTime;
  }

  public Timestamp getUpdateTime() {
    return updateTime;
  }

  public void setUpdateTime(Timestamp updateTime) {
    this.updateTime = updateTime;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    BaseGraphDO that = (BaseGraphDO) o;
    return Objects.equals(id, that.id)
        && Objects.equals(type, that.type)
        && Objects.equals(owner, that.owner)
        && Objects.equals(deleted, that.deleted)
        && Objects.equals(createTime, that.createTime)
        && Objects.equals(updateTime, that.updateTime);
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, type, owner, deleted, createTime, updateTime);
  }
}
